package com.yeahka.android.lepos;

import android.content.Context;
import android.net.Proxy;

import org.apache.http.params.HttpConnectionParams;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URLEncoder;

import retrofit2.http.HTTP;

public class Device {

    public static final boolean APP_DEBUG_ENVIRONMENT_FLAG = false;
    public static final int APP_MUST_UPDATE_ERROR = -1;
    public static final int APP_NETWORK_ENVIRONMENT_FLAG = 1;
    public static final int APP_SHOULD_UPDATE_ERROR = -2;
    public static final int APP_TYPE_ANDRIOD_SHUABAO = 10031;
    public static int DEVICE_VERSION = 275016;
//    public static final String DEVICE_VERSION_SHOW_TEXT = ak.configEncode();
    private static final int GPRS_PRINTER_SERVER_PROXY = 5;
    private static final int HONGBAO_SERVER_PROXY = 4;
    private static final int LED_SERVER_PROXY = 3;
    private static final int LESHUA_TRANSACTION_SERVER_PROXY = 2;
    private static final int LOGIN_SERVER_PROXY = 0;
    public static final String PLATFORM_TAG = "DEFAULT";
    private static final int QUICKEN_LOANS_PROXY = 7;
    private static final int REALNAME_PAYMENT_PROXY = 6;
    public static final int RUN_BY_APP = 0;
    private static String SECURITY_COMMAND = "1";
    public static final int SYSTEM_FAIL = -998;
    public static final String TAG = "LEPOS";
    public static final int TRANSACTION_NET_FAIL = -999;
    private static final int TRANSACTION_SERVER_PROXY = 1;
    public final int APP_TYPE;
    public int callType;
    private int device;
    public String error_code;
    public String error_msg;
    public boolean isWifiEnabled;
    private com.yeahka.android.leshua.Device leshuaDevice;
    private int shareAppData;
    public String simSerialNumber;
    private String strLocalDeviceId;




    static {
        System.loadLibrary("lepos");
    }


    public Device(Context context) {
        this.APP_TYPE = APP_TYPE_ANDRIOD_SHUABAO;
        this.leshuaDevice = null;
        this.shareAppData = nativeFunction00000();
        this.device = nativeFunction0(this.shareAppData);
        this.leshuaDevice = new com.yeahka.android.leshua.Device(this.shareAppData);
        this.leshuaDevice.a(APP_TYPE_ANDRIOD_SHUABAO);
        this.callType = 0;
        setAppType(APP_TYPE_ANDRIOD_SHUABAO);
        setLocalDeviceId(DeviceInfo.getDeviceId(context));
        setLocalMobile(DeviceInfo.phoneNum(context));
        setLocalIP(DeviceInfo.getIP());
        setSourceDir(DeviceInfo.sourceDir(context));
        this.simSerialNumber = DeviceInfo.uuid();
        setWifiStatus(DeviceInfo.netState());
    }


    private static Device instance;


    public static Device getInstance(Context context) {
        if (instance == null) {
            synchronized (Device.class) {
                if (instance == null) {
                    instance = new Device(context);
                }
            }
        }
        return instance;
    }




    public void setAppType(int i) {
        nativeFunction32(this.device, i);
    }

    public void setLocalDeviceId(String str) {
        this.strLocalDeviceId = str;
        this.leshuaDevice.a(str);
    }

    public void setLocalIP(String str) {
        this.leshuaDevice.c(str);
    }

    public void setLocalMobile(String str) {
        this.leshuaDevice.b(str);
    }

    public void setMerchantId(String str) {
        nativeFunction107(this.device, str);
    }

    public void setSessionID(String str) {
        nativeFunction106(this.device, str);
    }

    public void setSourceDir(String str) {
        nativeFunction5(this.device, str);
    }

    public void setUserName(String str) {
        nativeFunction105(this.device, str);
        this.leshuaDevice.f(str);
    }

    public void setWifiStatus(boolean z) {
        this.isWifiEnabled = z;
        this.leshuaDevice.a = z;
    }


    public int getDevice() {
        return device;
    }

    public void setDevice(int device) {
        this.device = device;
    }


    public String getSimSerialNumber() {
        return simSerialNumber;
    }

    public void setSimSerialNumber(String simSerialNumber) {
        this.simSerialNumber = simSerialNumber;
    }

    public static native int nativeFunction0(int i);

    public static native int nativeFunction00000();

    public static native void nativeFunction00001(int i);

    public static native void nativeFunction1(int i);

    public static native void nativeFunction10(int i, String str);

    public static native byte[] nativeFunction1000(int i);

    public static native byte[] nativeFunction10000(int i, String str, String str2);

    public static native byte[] nativeFunction10001(int i, String str, boolean z);

    public static native byte[] nativeFunction10002(int i);

    public static native byte[] nativeFunction10003(int i, String str, String str2, String str3, String str4, String str5, String str6, String str7, int i2);

    public static native byte[] nativeFunction10004(int i);

    public static native byte[] nativeFunction10005(int i, String str, int i2, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, int i3, int i4, int i5);

    public static native byte[] nativeFunction10006(int i);

    public static native byte[] nativeFunction10007(int i, String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, int i2);

    public static native byte[] nativeFunction10008(int i);

    public static native byte[] nativeFunction10009(int i, String str, String str2, String str3, String str4);

    public static native byte[] nativeFunction1001(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction1002(int i);

    public static native byte[] nativeFunction1003(int i);

    public static native byte[] nativeFunction1004(int i);

    public static native byte[] nativeFunction1005(int i, String str, String str2);

    public static native byte[] nativeFunction1006(int i);

    public static native byte[] nativeFunction1007(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction1008(int i);

    public static native byte[] nativeFunction1009(int i, String str, int i2, String str2, String str3, String str4, String str5, String str6, int i3, int i4);

    public static native byte[] nativeFunction1010(int i);

    public static native byte[] nativeFunction1011(int i, String str, String str2, String str3, String str4, String str5, String str6);

    public static native byte[] nativeFunction1012(int i);

    public static native byte[] nativeFunction1013(int i, String str, String str2, String str3, int i2);

    public static native byte[] nativeFunction1014(int i);

    public static native byte[] nativeFunction1015(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction1016(int i);

    public static native byte[] nativeFunction1017(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction1017(int i, String str, String str2, String str3, int i2);

    public static native byte[] nativeFunction1018(int i);

    public static native byte[] nativeFunction1019(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction1020(int i);

    public static native byte[] nativeFunction1021(int i, String str, int i2, String str2, String str3, String str4, String str5, String str6, int i3, int i4);

    public static native byte[] nativeFunction1022(int i, String str, String str2, String str3, String str4, String str5);

    public static native byte[] nativeFunction1023(int i, String str, int i2, String str2, String str3, String str4, String str5, String str6, String str7, String str8, int i3, int i4);

    public static native byte[] nativeFunction1024(int i);

    public static native byte[] nativeFunction1025(int i, String str, String str2, String str3, String str4);

    public static native byte[] nativeFunction1026(int i, String str, String str2, String str3, String str4, String str5, String str6, String str7);

    public static native byte[] nativeFunction1027(int i);

    public static native byte[] nativeFunction1028(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction1029(int i);

    public static native int nativeFunction103(int i, byte[] bArr);

    public static native byte[] nativeFunction1030(int i, String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9);

    public static native void nativeFunction105(int i, String str);

    public static native byte[] nativeFunction1052(int i);

    public static native byte[] nativeFunction1053(int i, String str, String str2, String str3, String str4, int i2);

    public static native byte[] nativeFunction1054(int i);

    public static native byte[] nativeFunction1055(int i, String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11);

    public static native byte[] nativeFunction1056(int i);

    public static native byte[] nativeFunction1057(int i, String str);

    public static native byte[] nativeFunction1058(int i);

    public static native byte[] nativeFunction1059(int i, String str, int i2, String str2, String str3, String str4, String str5, String str6, String str7, int i3, int i4, String str8, String str9, String str10, int i5);

    public static native void nativeFunction106(int i, String str);

    public static native byte[] nativeFunction1060(int i);

    public static native byte[] nativeFunction1061(int i);

    public static native byte[] nativeFunction1062(int i);

    public static native byte[] nativeFunction1063(int i, String str);

    public static native byte[] nativeFunction1064(int i);

    public static native byte[] nativeFunction1065(int i, String str);

    public static native byte[] nativeFunction1066(int i);

    public static native byte[] nativeFunction1067(int i);

    public static native byte[] nativeFunction1068(int i);

    public static native byte[] nativeFunction1069(int i, String str, String str2);

    public static native void nativeFunction107(int i, String str);

    public static native byte[] nativeFunction1070(int i);

    public static native byte[] nativeFunction1071(int i, String str, int i2, String str2, String str3, String str4, String str5);

    public static native byte[] nativeFunction1072(int i);

    public static native byte[] nativeFunction1073(int i, String str, String str2);

    public static native String nativeFunction11(int i);

    public static native void nativeFunction12(int i, int i2);

    public static native byte[] nativeFunction127(int i);

    public static native byte[] nativeFunction128(int i, String str);

    public static native int nativeFunction13(int i);

    public static native void nativeFunction14(int i, String str);

    public static native String nativeFunction15(int i);

    public static native byte[] nativeFunction190(int i);

    public static native byte[] nativeFunction191(int i, String str, String str2);

    public static native byte[] nativeFunction2(int i);

    public static native byte[] nativeFunction2000(int i);

    public static native byte[] nativeFunction20000(int i);

    public static native byte[] nativeFunction20001(int i, String str);

    public static native byte[] nativeFunction20002(int i, String str);

    public static native byte[] nativeFunction20003(int i);

    public static native byte[] nativeFunction20004(int i, String str);

    public static native byte[] nativeFunction20005(int i, String str);

    public static native byte[] nativeFunction2001(int i, String str);

    public static native byte[] nativeFunction2002(int i);

    public static native byte[] nativeFunction2003(int i, String str);

    public static native byte[] nativeFunction2004(int i);

    public static native byte[] nativeFunction2005(int i, int i2);

    public static native byte[] nativeFunction2006(int i);

    public static native byte[] nativeFunction2007(int i);

    public static native byte[] nativeFunction2008(int i);

    public static native byte[] nativeFunction2009(int i, int i2, int i3, String str, String str2);

    public static native byte[] nativeFunction2010(int i);

    public static native byte[] nativeFunction2011(int i, String str, String str2);

    public static native byte[] nativeFunction2012(int i);

    public static native byte[] nativeFunction2013(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction2014(int i);

    public static native byte[] nativeFunction2015(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction2016(int i);

    public static native byte[] nativeFunction2017(int i, String str, String str2);

    public static native byte[] nativeFunction2018(int i);

    public static native byte[] nativeFunction2019(int i, String str);

    public static native byte[] nativeFunction2020(int i);

    public static native byte[] nativeFunction2021(int i);

    public static native byte[] nativeFunction2022(int i);

    public static native byte[] nativeFunction2023(int i, String str, String str2);

    public static native byte[] nativeFunction2024(int i);

    public static native byte[] nativeFunction2025(int i, String str, String str2, String str3, int i2, String str4);

    public static native byte[] nativeFunction2026(int i);

    public static native byte[] nativeFunction2027(int i);

    public static native byte[] nativeFunction2028(int i, String str, String str2);

    public static native byte[] nativeFunction2029(int i, int i2, String str, String str2);

    public static native byte[] nativeFunction2030(int i);

    public static native byte[] nativeFunction2031(int i, int i2, String str, String str2, String str3);

    public static native byte[] nativeFunction2034(int i);

    public static native byte[] nativeFunction2035(int i, String str, String str2, int i2);

    public static native byte[] nativeFunction2036(int i);

    public static native byte[] nativeFunction2037(int i, int i2, int i3, String str, String str2, String str3);

    public static native byte[] nativeFunction2038(int i);

    public static native byte[] nativeFunction2039(int i, String str);

    public static native byte[] nativeFunction2040(int i);

    public static native byte[] nativeFunction2041(int i, String str, String str2);

    public static native byte[] nativeFunction2222(int i);

    public static native byte[] nativeFunction2223(int i);

    public static native byte[] nativeFunction2223(int i, String str, String str2, String str3, String str4, String str5, String str6, String str7, int i2);

    public static native byte[] nativeFunction2225(int i);

    public static native byte[] nativeFunction2226(int i);

    public static native byte[] nativeFunction2227(int i);

    public static native byte[] nativeFunction2228(int i);

    public static native byte[] nativeFunction2229(int i);

    public static native byte[] nativeFunction2230(int i);

    public static native byte[] nativeFunction2231(int i);

    public static native byte[] nativeFunction2232(int i);

    public static native byte[] nativeFunction2233(int i);

    public static native byte[] nativeFunction2234(int i, String str, String str2, String str3, String str4);

    public static native byte[] nativeFunction2235(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction2236(int i, String str, String str2, String str3, String str4, String str5, String str6);

    public static native byte[] nativeFunction2237(int i, String str, String str2, String str3, String str4, String str5, String str6, String str7);

    public static native byte[] nativeFunction2238(int i, String str, String str2, String str3, String str4, String str5, String str6, int i2, String str7);

    public static native byte[] nativeFunction2239(int i, String str, String str2, String str3, String str4, String str5, String str6);

    public static native byte[] nativeFunction2240(int i, String str, String str2, String str3, String str4, String str5);

    public static native byte[] nativeFunction2241(int i, String str, String str2, String str3, String str4, int i2, String str5);

    public static native byte[] nativeFunction3(int i, String str, int i2, String str2);

    public static native byte[] nativeFunction3012(int i);

    public static native byte[] nativeFunction3013(int i, String str, String str2, String str3);

    public static native byte[] nativeFunction3015(int i);

    public static native byte[] nativeFunction3020(int i);

    public static native byte[] nativeFunction3021(int i, String str, String str2, String str3, String str4, String str5, String str6);

    public static native byte[] nativeFunction3022(int i);

    public static native byte[] nativeFunction3023(int i, String str, String str2, String str3, String str4, String str5, String str6, String str7, int i2);

    public static native void nativeFunction32(int i, int i2);

    public static native void nativeFunction38(int i, String str);

    public static native String nativeFunction39(int i);

    public static native void nativeFunction4(int i, int i2, int i3, int i4);

    public static native void nativeFunction40(int i, String str);

    public static native String nativeFunction41(int i);

    public static native void nativeFunction42(int i, String str);

    public static native String nativeFunction43(int i);

    public static native void nativeFunction46(int i, String str);

    public static native void nativeFunction5(int i, String str);

    public static native void nativeFunction52(int i, String str);

    public static native String nativeFunction53(int i);

    public static native void nativeFunction54(int i, String str);

    public static native String nativeFunction55(int i);

    public static native void nativeFunction56(int i, String str);

    public static native String nativeFunction57(int i);

    public static native byte[] nativeFunction59(int i, byte[] bArr, byte[] bArr2);

    public static native void nativeFunction6(int i, int i2);

    public static native byte[] nativeFunction60(int i, byte[] bArr, byte[] bArr2, byte[] bArr3);

    public static native byte[] nativeFunction61(int i, byte[] bArr, byte[] bArr2, byte[] bArr3, byte[] bArr4);

    public static native int nativeFunction66(int i);

    public static native byte[] nativeFunction67(int i);

    public static native byte[] nativeFunction68(int i, String str, String str2, Object obj);

    public static native void nativeFunction7(int i, int i2);

    public static native byte[] nativeFunction71(int i);

    public static native byte[] nativeFunction72(int i);

    public static native void nativeFunction8(int i, int i2);

    public static native byte[] nativeFunction82(int i);

    public static native byte[] nativeFunction83(int i);

    public static native byte[] nativeFunction84(int i);

    public static native byte[] nativeFunction85(int i);

    public static native int nativeFunction9(int i);








}
